﻿using Assets.Script.Data.EnemyData;
using Assets.Script.Human.Enemy.Actions;
using Assets.Script.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Script.UiSystem;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SocialPlatforms;

namespace Assets.Script.Human.Enemy.Enemys
{
    class StraightAI: EnemyAI
    {
        private static GameObject loseBoold;
        public static GameObject dropCoin;
        public static GameObject dropMilk;
        public static GameObject dieEffect;

        public override void Init(EnemyData enemyData,int netId, int dieFrame)
        {
            base.Init(enemyData,netId, dieFrame);
            body.ReInit();
            actions.Init(
                new IAction[]
                {
                        new Idle(body),
                        null,
                        null,
                        null,
                        new BeAtk(body),
                        new FlyStraight(body),
                        new Die(body),
                }
            );
            
        }

        private void OnTriggerEnter(Collider other)
        {
            if (other.tag=="Player")
            {
                other.GetComponent<HumanInterface>().TakeDamage(body.Data.Damage, 0, 0, transform.position);
            }
        }
    }
}
